package cn.stylefeng.guns.modular.rest.fi;

import cn.stylefeng.guns.base.pojo.page.LayuiPageInfo;
import cn.stylefeng.guns.modular.fi.model.params.FiCarrierFreightInfoParam;
import cn.stylefeng.guns.modular.fi.service.FiCarrierFreightInfoService;
import cn.stylefeng.guns.modular.rest.aop.UserAop;
import cn.stylefeng.guns.modular.rest.fi.vo.FiCarrierFreightRSVo;
import cn.stylefeng.guns.sys.modular.system.entity.User;
import cn.stylefeng.roses.core.base.controller.BaseController;
import cn.stylefeng.roses.core.reqres.response.ResponseData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;


/**
 *地址控制器
 */
@Controller
@RequestMapping("/rest/fiCarrierFreight")
public class FiCarrierFreightController extends BaseController {

    @Autowired
    private UserAop userAop;

    @Autowired
    private FiCarrierFreightInfoService fiCarrierFreightInfoService;

    @ResponseBody
    @RequestMapping("/list")
    public List<FiCarrierFreightRSVo> list(FiCarrierFreightInfoParam fiCarrierFreightInfoParam) {
        User user = userAop.getUser();
        fiCarrierFreightInfoParam.setStat("对账中");
        fiCarrierFreightInfoParam.setCarrierUserCode(user.getAccount());
        return this.fiCarrierFreightInfoService.getCarrierFreightList(fiCarrierFreightInfoParam);
    }

    /**
     * 修改状态
     * @param fiCarrierFreightInfoParam
     * @return
     */
    @RequestMapping("/updateStat")
    @ResponseBody
    public ResponseData updateStat(FiCarrierFreightInfoParam fiCarrierFreightInfoParam) {
        this.fiCarrierFreightInfoService.update(fiCarrierFreightInfoParam);
        return ResponseData.success();
    }


}
